package com.zyh.server.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: zyh
 * @Date: 2024-11-20-14:56
 * @Description RabbitMQ配置
 */
@Slf4j
@Configuration
public class MQConfig {

	// 设置队列名称(路由键和队列名称必须完全一致)
	public static final String miaosha_queue = "miaosha_queue";

	/**
	 * 创建消息队列
	 * @return
	 */
	@Bean
	public Queue createQueue() {
		log.info("{}队列创建成功",miaosha_queue);
		/**
		 * 参数一：队列名称
		 * 参数二：是否持久化
		 */
		return new Queue(miaosha_queue,false);
	}
}
